var loginData = JSON.parse(decodeURIComponent(web.readCookie("loginData")));
console.log(loginData);
$('#reset').click(function () {
    $('input').val('');
})
var dataSource1 = new Array();
var dataSource2 = new Array();
//table的数据源
var table;   //table对象
var a = getQueryString('sendCouponId');
var user = loginData.user.name;
dataSource1 = [];
dataSource2 = [];

function show() {
    var bh = document.getElementsByClassName('bohui');
    bh[0].classList.remove('hidden');
}

function hide() {
    var bh = document.getElementsByClassName('bohui');
    bh[0].classList.add('hidden');
}

$.ajax({
    url: root.couponInter.coupon_queryAuditDetail,
    cache: false,  //禁用缓存
    type: "POST",
    dataType: 'json',
    // contentType: "application/json",
    data: {
        "sendCouponId": a
    },
    success: function (data) {
        if (data.couponSend.sendCouponType == 1) {
            $("#fafyh").css({
                display: "block"
            });
            $("#topic-2").css({
                display: "none"
            });
            $("#topic-3").css({
                display: "none"
            });
            $("#applicablePricetype").css({
                display: "none"
            });
        }
        if (data.couponSend.sendCouponType == 2) {
            $("#fafsz").css({
                display: "block"
            });
            $("#topic-1").css({
                display: "none"
            });
            $("#topic-3").css({
                display: "none"
            });
            if(data.couponSend.sendCondition==4){
                $("#applicablePricetype").css({
                    display: "block"
                });
            }else {
                $("#applicablePricetype").css({
                    display: "none"
                });
            }

        }
        if (data.couponSend.sendCouponType == 3) {
            $("#fafsz").css({
                display: "block"
            });
            $("#sendConditiondd").css({
                display: "none"
            });
            $("#topic-1").css({
                display: "none"
            });
            $("#topic-2").css({
                display: "none"
            });
            $("#applicablePricetype").css({
                display: "block"
            });
        }
        if (data.couponSend.sendCouponType == 4) {
            $("#fafsz").css({
                display: "block"
            });
            $("#topic-1").css({
                display: "none"
            });
            $("#topic-3").css({
                display: "none"
            });
            $("#applicablePricetype").css({
                display: "none"
            });
        }
        if (data.couponSend.priceType == 20) {
            $("#priceType").html("现金价")
        }else if (data.couponSend.priceType == 10) {
            $("#priceType").html("售价")
        }else if (data.couponSend.priceType == 0) {
            $("#priceType").html("现金价   售价")
        }else {
            $("#priceType").html("")
        }
        var b = data.couponSend;
        $('#sendCouponCode').html(b.sendCouponCode);
        $('#sendCouponName').html(b.sendCouponName);
        $('#sendCouponDept').html(b.sendCouponDept);
        $('#sendCouponUser').html(b.sendCouponUser);
        $('#sendReasonDutyDept').html(sendDutyDept(b.sendReasonDutyDept));
        if (b.sendCouponReason == 11) {
            $('#sendCouponReason').html('质量问题');
        } else if (b.sendCouponReason == 12) {
            $('#sendCouponReason').html('无货问题');
        } else if (b.sendCouponReason == 21) {
            $('#sendCouponReason').html('配送延迟');
        } else if (b.sendCouponReason == 22) {
            $('#sendCouponReason').html('状态维护错误');
        } else if (b.sendCouponReason == 23) {
            $('#sendCouponReason').html('私自拒收');
        } else if (b.sendCouponReason == 24) {
            $('#sendCouponReason').html('包装/商品破损');
        } else if (b.sendCouponReason == 25) {
            $('#sendCouponReason').html('违规收费');
        } else if (b.sendCouponReason == 26) {
            $('#sendCouponReason').html('服务态度差');
        } else if (b.sendCouponReason == 27) {
            $('#sendCouponReason').html('错漏发');
        } else if (b.sendCouponReason == 31) {
            $('#sendCouponReason').html('退款时效慢');
        } else if (b.sendCouponReason == 32) {
            $('#sendCouponReason').html('发票信息有误');
        } else if (b.sendCouponReason == 33) {
            $('#sendCouponReason').html('退款金额有误');
        } else if (b.sendCouponReason == 34) {
            $('#sendCouponReason').html('开具发票时间延迟');
        } else if (b.sendCouponReason == 41) {
            $('#sendCouponReason').html('商品参数错误');
        } else if (b.sendCouponReason == 42) {
            $('#sendCouponReason').html('价格错误');
        } else if (b.sendCouponReason == 43) {
            $('#sendCouponReason').html('活动与实际不符');
        } else if (b.sendCouponReason == 44) {
            $('#sendCouponReason').html('活动优惠券补发');
        } else if (b.sendCouponReason == 45) {
            $('#sendCouponReason').html('活动优惠券发放');
        } else if (b.sendCouponReason == 51) {
            $('#sendCouponReason').html('特殊售后问题');
        } else if (b.sendCouponReason == 52) {
            $('#sendCouponReason').html('提升客户体验');
        } else if (b.sendCouponReason == 53) {
            $('#sendCouponReason').html('承诺错误');
        } else if (b.sendCouponReason == 54) {
            $('#sendCouponReason').html('售后时间长');
        } else if (b.sendCouponReason == 61) {
            $('#sendCouponReason').html('售后运费补偿');
        } else if (b.sendCouponReason == 62) {
            $('#sendCouponReason').html('错发运费补偿');
        } else if (b.sendCouponReason == 71) {
            $('#sendCouponReason').html('订单未流转');
        } else if (b.sendCouponReason == 72) {
            $('#sendCouponReason').html('活动未绑定优惠券、赠品');
        } else if (b.sendCouponReason == 73) {
            $('#sendCouponReason').html('系统自动取消');
        } else if (b.sendCouponReason == 74) {
            $('#sendCouponReason').html('页面缓存问题');
        }
        $('#description').html(b.description);
        //发券设置
        var sendCouponTypess = ""
        if (b.sendCouponType == 1) {
            sendCouponTypess = "手动发券"
        } else if (b.sendCouponType == 2) {
            sendCouponTypess = "自动发券"
        } else if (b.sendCouponType == 3) {
            sendCouponTypess = " 客户领取发券"
        }else if (b.sendCouponType == 4) {
            sendCouponTypess = " 抽奖发送"
        }

        $('#sendCouponType').html(sendCouponTypess);

        let customerTypes = b.customerType;
        let customerTypesArr = customerTypes.split(",");
        let issuingCustomersVal = "";
        for (let i = 0; i < customerTypesArr.length; i++) {
            if (11 == customerTypesArr[i]) {
                issuingCustomersVal = issuingCustomersVal + "&nbsp&nbsp&nbsp" + "签约客户(非分销)"
            }
            if (12 == customerTypesArr[i]) {
                issuingCustomersVal = issuingCustomersVal + "&nbsp&nbsp&nbsp" + "签约客户(分销)"
            }
            if (20 == customerTypesArr[i]) {
                issuingCustomersVal = issuingCustomersVal + "&nbsp&nbsp&nbsp" + "普通客户"
            }
            if (30 == customerTypesArr[i]) {
                issuingCustomersVal = issuingCustomersVal + "&nbsp&nbsp&nbsp" + "认证客户"
            }
            if (40 == customerTypes) {
                issuingCustomersVal = "签约客户(非分销)" + "&nbsp&nbsp&nbsp" + "签约客户(分销)" + "&nbsp&nbsp&nbsp" + "普通客户" + "&nbsp&nbsp&nbsp" + "认证客户"
            }

        }
        $('#issuingCustomers').html(issuingCustomersVal);

        var sendConditionss = ""
        if (b.sendCondition == 1) {
            sendConditionss = "新注册客户"
            $("#two-1").css({
                display: "none"
            });
            $("#two-2").css({
                display: "none"
            });

            $("#two-3").css({
                display: "none"
            });
        } else if (b.sendCondition == 0) {
            sendConditionss = ""
            $("#two-1").css({
                display: "none"
            });
            $("#two-2").css({
                display: "none"
            });

            $("#two-3").css({
                display: "none"
            });
        } else if (b.sendCondition == 2) {
            sendConditionss = "满足订单金额条件";
            $("#two-1").css({
                display: "block"
            });
            $("#two-2").css({
                display: "block"
            });

            $("#two-3").css({
                display: "block"
            });
            $('#orderAmount').val(b.orderAmount);
            var whosus= sessionStorage.getItem("whosus")
            if (data.couponSend.applWarehouse == whosus) {
                document.getElementById("wareHouse").checked = true;
                $("input[name='wareHouse']").each(function () {
                    $(this).prop("checked", true);
                });
            } else {
                var groupCheckbox = data.couponSend.applWarehouse.split(",");
                for (var i = 0; i < groupCheckbox.length; i++) {
                    var warehouses=JSON.parse(sessionStorage.getItem("warehouses"))
                    var ss=""
                    $.each(warehouses.data,function(k,s){
                        if(groupCheckbox[i]==s.warehouseCode){
                            $('#wareHouse'+s.warehouseCode+'').prop("checked", true);
                        }
                    })
                }
            }
            var groupCheckbox = data.couponSend.applPaidType.split(",");
            for (var i = 0; i < groupCheckbox.length; i++) {
                if (groupCheckbox[i] == '1001') {
                    $('#payType1').prop("checked", true);
                }
                if (groupCheckbox[i] == '1301') {
                    $('#payType2').prop("checked", true);
                }
                if (groupCheckbox[i] == '1401') {
                    $('#payType3').prop("checked", true);
                }
                if (groupCheckbox[i] == '1101') {
                    $('#payType4').prop("checked", true);
                }
                if (groupCheckbox[i] == '1201') {
                    $('#payType5').prop("checked", true);
                }
                if (groupCheckbox[i] == '1701') {
                    $('#payType6').prop("checked", true);
                }
            }
        }else  if (b.sendCondition == 3) {
            sendConditionss = "客户中奖后自动发放"
            $("#two-1").css({
                display: "none"
            });
            $("#two-2").css({
                display: "none"
            });

            $("#two-3").css({
                display: "none"
            });
        }else if (b.sendCondition == 4) {
            sendConditionss = "按照客户的价格类型"
            $("#two-1").css({
                display: "none"
            });
            $("#two-2").css({
                display: "none"
            });

            $("#two-3").css({
                display: "none"
            });
        }
        $('#sendCondition').html(sendConditionss);
        var endTimess = ""
        if (b.endTime != null && b.endTime != '') {
            endTimess = b.endTime
        } else {
            endTimess = "不限"
        }
        $('#timess').html(b.startTime + "~" + endTimess);
        custlist(data);
        console.log(b.sendCouponType)
        if (b.sendCouponType == 1) {
            couponlist_1(data.couponSendTopicList);
        } else if (b.sendCouponType == 2) {
            couponlist_2(data.couponSendTopicList);
        }else if (b.sendCouponType == 4) {
            couponlist_2(data.couponSendTopicList);
        } else {
            couponlist_3(data.couponSendTopicList);
        }
        document.getElementById('datatable1_filter').classList.add('f-l');
        document.getElementById('datatable1_filter').classList.add('chaxun');
    },
    error: function () {
        $.Huimodalalert('失败！', 3000);
    }
});

function custlist(data) {
    dataSource1.splice(0, dataSource1.length);//清空数组
    $.each(data.couponSendCustomerList, function (i, field) {
        var rowData = new Array();
        rowData.push(field.memberId);
        rowData.push(field.custType);
        rowData.push(field.custName);
        rowData.push(field.custArea);
        rowData.push(field.createdAt);
        dataSource1.push(rowData);
    });
    initDataTable(dataSource1);
    function initDataTable(dataSource1) {
        var dttable = $('#datatable1').dataTable(); // 初始化dataTable，清空上一个值
        dttable.fnClearTable(); //清空一下table
        dttable.fnDestroy(); //还原初始化了的datatable
        $("#datatable1").DataTable({
            "autoWidth": false,
            "ordering": true,
            "searching": true,
            "paging": true,
            "retrieve": true,
            "destroy": true,
            "bAutoWidth": true,
            "bLengthChange": true,
            "aLengthMenu": [10, 25, 50],
            "oLanguage": {
                "sSearch": "客户名称：",
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "抱歉， 没有找到",
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty": "没有数据",
                "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                },
                "sZeroRecords": "没有检索到数据",
            },
            data: dataSource1,
            columnDefs: [
                {
                    "visible": true,
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if (row[1] == 11) {
                            val = '签约客户(非分销)';
                            return val;
                        } else if (row[1] == 12) {
                            val = '签约客户(分销)';
                            return val;
                        } else if (row[1] == 20) {
                            val = '普通客户';
                            return val;
                        } else if (row[1] == 30) {
                            val = '认证客户';
                            return val;
                        }
                    },
                    "targets": 1
                }
            ]
        });
    };
}

function couponlist_1(data) {
    console.log(data)
    dataSource2.splice(0, dataSource2.length);//清空数组
    $.each(data, function (i, field) {
        var rowData = new Array();
        rowData.push(field.topicType);
        rowData.push(field.topicCode);
        rowData.push(field.topicName);
        rowData.push(field.amount);
        rowData.push(field.useBegtime);
        rowData.push(field.topicStatus);
        rowData.push(field.issuedNum);
        rowData.push(field.sendNum);
        rowData.push(field.useEndtime);
        rowData.push(field.dayNumber);
        rowData.push(field.sendTotalNum);
        dataSource2.push(rowData);
    });
    initDataTable(dataSource2);

    function initDataTable(dataSource2) {
        var dttable = $('#datatable2').dataTable(); // 初始化dataTable，清空上一个值
        dttable.fnClearTable(); //清空一下table
        dttable.fnDestroy(); //还原初始化了的datatable
        $("#datatable2").DataTable({
            "autoWidth": false,
            "ordering": false,
            "searching": false,
            "paging": true,
            "retrieve": false,
            "destroy": false,
            "bAutoWidth": false,
            "bLengthChange": false,
            "aLengthMenu": [10, 25, 50],
            "oLanguage": {
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "抱歉， 没有找到",
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty": "没有数据",
                "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                },
                "sZeroRecords": "没有检索到数据",
            },
            data: dataSource2,
            columnDefs: [
                {
                    "visible": true,
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if (row[0] == 10) {
                            val = '满减券';
                            return val;
                        } else {
                            val = '运费券';
                            return val;
                        }
                    },
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        if (row[9] == 0) {
                            if (row[8] != null) {
                                var val = '<span>' + row[4] + '</span><br>~<br><span>' + row[8] + '</span>';
                                return val;
                            }
                            else {
                                var val = '<span>' + row[4] + '</span><br>~<br><span>不限</span>';
                                return val;
                            }
                        }
                        else {
                            var val = '<span>领到券当日开始' + row[9] + '天内有效</span>';
                            return val;
                        }
                    },
                    "targets": 4
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if (row[5] == 10) {
                            val = '已生效';
                            return val;
                        } else if (row[5] == 20) {
                            val = '已发放完';
                            return val;
                        } else if (row[5] == 30) {
                            val = '已失效';
                            return val;
                        }
                        return val;
                    },
                    "targets": 5
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        val = row[7];
                        return val;
                    },
                    "targets": 6
                },
            ]
        });
    };
}

function couponlist_2(data) {
    console.log(data)
    dataSource2.splice(0, dataSource2.length);//清空数组
    $.each(data, function (i, field) {
        var rowData = new Array();
        rowData.push(field.topicType);
        rowData.push(field.topicCode);
        rowData.push(field.topicName);
        rowData.push(field.amount);
        rowData.push(field.useBegtime);
        rowData.push(field.topicStatus);
        rowData.push(field.issuedNum);
        rowData.push(field.sendNum);
        rowData.push(field.useEndtime);
        rowData.push(field.dayNumber);
        rowData.push(field.sendTotalNum);
        dataSource2.push(rowData);
    });
    initDataTable(dataSource2);

    function initDataTable(dataSource2) {
        var dttable = $('#datatable3').dataTable(); // 初始化dataTable，清空上一个值
        dttable.fnClearTable(); //清空一下table
        dttable.fnDestroy(); //还原初始化了的datatable
        $("#datatable3").DataTable({
            "autoWidth": false,
            "ordering": false,
            "searching": false,
            "paging": true,
            "retrieve": false,
            "destroy": false,
            "bAutoWidth": false,
            "bLengthChange": false,
            "aLengthMenu": [10, 25, 50],
            "oLanguage": {
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "抱歉， 没有找到",
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty": "没有数据",
                "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                },
                "sZeroRecords": "没有检索到数据",
            },
            data: dataSource2,
            columnDefs: [
                {
                    "visible": true,
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if (row[0] == 10) {
                            val = '满减券';
                        } else {
                            val = '运费券';
                        }
                        return val;
                    },
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        if (row[9] == 0) {
                            if (row[8] != null) {
                                var val = '<span>' + row[4] + '</span><br>~<br><span>' + row[8] + '</span>';
                                return val;
                            }
                            else {
                                var val = '<span>' + row[4] + '</span><br>~<br><span>不限</span>';
                                return val;
                            }
                        }
                        else {
                            var val = '<span>领到券当日开始' + row[9] + '天内有效</span>';
                            return val;
                        }
                    },
                    "targets": 4
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if (row[5] == 10) {
                            val = '已生效';
                            return val;
                        } else if (row[5] == 20) {
                            val = '已发放完';
                            return val;
                        } else if (row[5] == 30) {
                            val = '已失效';
                            return val;
                        }
                        return val;
                    },
                    "targets": 5
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = row[10];

                        return val;
                    },
                    "targets": 8
                },

            ]
        });
    };
}

function couponlist_3(data) {
    console.log(data)
    dataSource2.splice(0, dataSource2.length);//清空数组
    $.each(data, function (i, field) {
        var rowData = new Array();
        rowData.push(field.topicType);
        rowData.push(field.topicCode);
        rowData.push(field.topicName);
        rowData.push(field.amount);
        rowData.push(field.useBegtime);
        rowData.push(field.topicStatus);
        rowData.push(field.issuedNum);
        rowData.push(field.sendNum);
        rowData.push(field.useEndtime);
        rowData.push(field.dayNumber);
        rowData.push(field.sendTotalNum);
        dataSource2.push(rowData);
    });
    initDataTable(dataSource2);

    function initDataTable(dataSource2) {
        var dttable = $('#datatable4').dataTable(); // 初始化dataTable，清空上一个值
        dttable.fnClearTable(); //清空一下table
        dttable.fnDestroy(); //还原初始化了的datatable
        $("#datatable4").DataTable({
            "autoWidth": false,
            "ordering": false,
            "searching": false,
            "paging": true,
            "retrieve": false,
            "destroy": false,
            "bAutoWidth": false,
            "bLengthChange": false,
            "aLengthMenu": [10, 25, 50],
            "oLanguage": {
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "抱歉， 没有找到",
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty": "没有数据",
                "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                },
                "sZeroRecords": "没有检索到数据",
            },
            data: dataSource2,
            columnDefs: [
                {
                    "visible": true,
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if (row[0] == 10) {
                            val = '满减券';
                        } else {
                            val = '运费券';
                        }
                        return val;
                    },
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        if (row[9] == 0) {
                            if (row[8] != null) {
                                var val = '<span>' + row[4] + '</span><br>~<br><span>' + row[8] + '</span>';
                                return val;
                            }
                            else {
                                var val = '<span>' + row[4] + '</span><br>~<br><span>不限</span>';
                                return val;
                            }
                        }
                        else {
                            var val = '<span>领到券当日开始' + row[9] + '天内有效</span>';
                            return val;
                        }
                    },
                    "targets": 4
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '';
                        if (row[5] == 10) {
                            val = '已生效';
                            return val;
                        } else if (row[5] == 20) {
                            val = '已发放完';
                            return val;
                        } else if (row[5] == 30) {
                            val = '已失效';
                            return val;
                        }
                        return val;
                    },
                    "targets": 5
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = row[10];

                        return val;
                    },
                    "targets": 8
                },

            ]
        });
    };
}

var checkKey = 0;
$('#submitCheck').click(function () {
    if ($("input[type='radio'][value='审核通过']").is(':checked')) {
        layer.confirm('您确定审核通过？', function (index) {
            checkKey = ++checkKey;
            if (checkKey == 1) {
                $('.layui-layer-setwin').hide();
                $('.layui-layer-btn').hide();
                $('.layui-layer-title').hide();
                $('.layui-layer-content').hide();
                $('.layui-layer-ico layui-layer-close layui-layer-close1').hide();
                $('#layui-layer-shade1').hide();
                //加载等待样式
                $("#beijing").css("display", "block");
                $("#myLoading").css("display", "block");
                $.ajax({
                    url: root.couponInter.coupon_oneAuditPass,
                    cache: false,  //禁用缓存
                    type: "POST",
                    dataType: 'json',
                    // contentType: "application/json",
                    data: {
                        "sendCouponId": a,
                        "auditPersonName": user
                    },
                    success: function (data) {
                        if (data.code == '0') {
                            //影藏等待样式
                            $("#beijing").css("display", "none");
                            $("#myLoading").css("display", "none");
                            $.Huimodalalert('审核通过！', 1000);
                            setTimeout(function () {
                                parent.searchList(parent.comPageNum); // 父页面刷新
                                cancelLayerNoRefreshFn();
                            }, 1000);
                        } else {
                            //影藏等待样式
                            $("#beijing").css("display", "none");
                            $("#myLoading").css("display", "none");
                            $.Huimodalalert(data.message, 2000);
                        }
                    },
                    error: function () {
                        //影藏等待样式
                        $("#beijing").css("display", "none");
                        $("#myLoading").css("display", "none");
                        $.Huimodalalert('系统异常,提交审核结果失败！', 2000);
                    }
                })
                // layer.closeAll();
            }
        });

    }
    else if ($("input[type='radio'][value='审核不通过']").is(':checked')) {
        var failReason = $('#failReason').val();
        var failExplan = $('#failExplan').val();
        if (failReason == '' || failExplan == '') {
            $.Huimodalalert('请您输入不通过原因！', 1000)
        } else {
            layer.confirm('您确认审核不通过?', function (index) {
                checkKey = ++checkKey;
                if (checkKey == 1) {
                    $.ajax({
                        url: root.couponInter.coupon_oneAuditNotPass,
                        cache: false,  //禁用缓存
                        type: "POST",
                        dataType: 'json',
                        // contentType: "application/json",
                        data: {
                            "sendCouponId": a,
                            "auditPersonName": user,
                            "failReason": failReason,
                            "failExplan": failExplan
                        },
                        success: function (data) {
                            $.Huimodalalert('不通过成功！', 2000);
                            setTimeout(function () {
                                parent.searchList(1); // 父页面刷新
                                var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                                parent.layer.close(index);
                            }, 1000);
                        },
                        error: function () {
                            $.Huimodalalert('系统异常,提交审核结果失败！', 2000);
                        }
                    })
                    layer.close(index);
                }
            });
        }


    }
})

$('#putout').attr("href", root.couponInter.coupon_exportUserExcel + a);

function sendDutyDept(Val) {
    switch (parseInt(Val)) {
        case 1:
            return '商品问题';
            break;
        case 2:
            return '仓储/物流问题';
            break;
        case 3:
            return '财务问题';
            break;
        case 4:
            return '网站运营问题';
            break;
        case 5:
            return '服务体验问题';
            break;
        case 6:
            return '运费问题';
            break;
        case 7:
            return '技术问题';
            break;
    }

}